<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/base.js"></script>
</head>
<body>
<h1>新增课程</h1>
课程名称:<input id="name"/><br>
授课教师:<input id="teacherName"/><br>
教室容量:<input id="sMax"/><br><br>
<button style="position: relative; left: 68px;" onclick="onAddClick();">确认添加</button>
<script>
    function onAddClick() {
        let json={};
        json.name=document.getElementById("name").value;
        json.teacherName=document.getElementById("teacherName").value;
        json.sMax=document.getElementById("sMax").value;

        let url="http://localhost:9001/Demo/course/course";
        let method="post";
        $.rest(method,url,json,function (r) {
            if (r.code==200){
                window.location.href="teacher.html";
            }
        });
    }
</script>
</body>
</html>